package com.divemotor.ventarepuestosinternet.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class VehiculoNroSaPK implements Serializable{

	private static final long serialVersionUID = -6813576598953393842L;
	
	@Column(name="NUM_CHASIS", nullable=false, length=20)
	private String numChasis;
	@Column(name="COD_GRUPO", nullable=false, length=2)
	private String codGrupo;
	@Column(name="NRO_CORR_SA", nullable=false, length=10)
	private String nroCorrSa;
	@Column(name="NRO_EXT_SA", nullable=false, length=5)
	private String nroExtSa;
	
	public String getNumChasis() {
		return numChasis;
	}
	
	public void setNumChasis(String numChasis) {
		this.numChasis = numChasis;
	}
	
	public String getCodGrupo() {
		return codGrupo;
	}
	
	public void setCodGrupo(String codGrupo) {
		this.codGrupo = codGrupo;
	}
	
	public String getNroCorrSa() {
		return nroCorrSa;
	}
	
	public void setNroCorrSa(String nroCorrSa) {
		this.nroCorrSa = nroCorrSa;
	}
	
	public String getNroExtSa() {
		return nroExtSa;
	}
	
	public void setNroExtSa(String nroExtSa) {
		this.nroExtSa = nroExtSa;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((codGrupo == null) ? 0 : codGrupo.hashCode());
		result = prime * result + ((nroCorrSa == null) ? 0 : nroCorrSa.hashCode());
		result = prime * result + ((nroExtSa == null) ? 0 : nroExtSa.hashCode());
		result = prime * result + ((numChasis == null) ? 0 : numChasis.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		VehiculoNroSaPK other = (VehiculoNroSaPK) obj;
		if (codGrupo == null) {
			if (other.codGrupo != null){
				return false;
			}
		} else if (!codGrupo.equals(other.codGrupo)){
			return false;
		}
		if (nroCorrSa == null) {
			if (other.nroCorrSa != null){
				return false;
			}
		} else if (!nroCorrSa.equals(other.nroCorrSa)){
			return false;
		}
		if (nroExtSa == null) {
			if (other.nroExtSa != null){
				return false;
			}
		} else if (!nroExtSa.equals(other.nroExtSa)){
			return false;
		}
		if (numChasis == null) {
			if (other.numChasis != null){
				return false;
			}
		} else if (!numChasis.equals(other.numChasis)){
			return false;
		}
		return true;
	}
	
}
